home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / C / Games / Xconq 7.1.0 / src / xconq-7.1.0 / kernel / imf.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-07-07  |  4.8 KB  |  129 lines  |  [TEXT/R*ch]

  1. /* Definitions for Xconq images.
  2.    Copyright (C) 1992, 1993, 1994, 1995 Stanley T. Shebs.
  3.  
  4. Xconq is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2, or (at your option)
  7. any later version.  See the file COPYING.  */
  8.  
  9. /* An image family is like a finder icon family, but allows multiple kinds
  10.    of images of an arbitrary set of sizes. */
  11.  
  12. typedef struct a_image {
  13.     int w, h;            /* Nominal size of the image */
  14.     int minw, minh;        /* Minimum size to scale to */
  15.     int maxw, maxh;        /* Maximum size to scale to */
  16.     int istile;            /* True if image may be used as tile */
  17.     char *embedname;        /* Name of an embedded subimage (imf name) */
  18.     int embedx, embedy;        /* Position to draw an embedded subimage */
  19.     int embedw, embedh;        /* Size of space for embedded subimage */
  20.     Obj *monodata;        /* Monochrome data, in GDL form */
  21.     Obj *colrdata;        /* Color data, in GDL form */
  22.     Obj *maskdata;        /* Mask data, in GDL form */
  23.     int actualw, actualh;
  24.     int pixelsize;
  25.     int rowbytes;
  26.     Obj *palette;
  27.     Obj *notes;            /* designer notes about the image */
  28.     char *rawmonodata;        /* Monochrome data, as array of bytes */
  29.     char *rawcolrdata;        /* Color data, as array of bytes */
  30.     char *rawmaskdata;        /* Mask data, as array of bytes */
  31.     int *rawpalette;
  32.     int numcolors;        /* Number of colors in raw palette */
  33.     char *hook;            /* Pointer to interface-specific data */
  34.     struct a_image *next;    /* Pointer to next image in family */
  35. } Image;
  36.  
  37. typedef struct a_image_family {
  38.     char *name;            /* Name of the family */
  39.     int ersatz;            /* True if this image is a substitute */
  40.     struct a_image_file *location;  /* File or whatever to look for data */
  41.     Obj *notes;            /* designer notes about the image family */
  42.     int numsizes;        /* Number of images in the list */
  43.     Image *images;
  44. } ImageFamily;
  45.  
  46. typedef struct a_image_palette {
  47.     char *name;            /* Name of the palette */
  48.     struct a_image_file *location;  /* File or whatever to look for data */
  49.     Obj *notes;            /* designer notes about the palette */
  50.     int numcolors;        /* Number of colors in the palette */
  51. } ImagePalette;
  52.  
  53. typedef struct a_image_color {
  54.     char *name;            /* Name of the color */
  55.     struct a_image_file *location;  /* File or whatever to look for data */
  56.     Obj *notes;            /* designer notes about the color */
  57.     short defined;
  58.     short r, g, b;
  59. } ImageColor;
  60.  
  61. typedef struct a_image_file {
  62.     char *name;
  63.     int loaded;
  64.     struct a_image_file *next;
  65. } ImageFile;
  66.  
  67. extern ImageFamily **images;
  68.  
  69. extern int numimages;
  70.  
  71. extern ImagePalette **palettes;
  72.  
  73. extern int numpalettes;
  74.  
  75. extern ImageColor **colors;
  76.  
  77. extern int numcolors;
  78.  
  79. extern ImageFile *image_files;
  80.  
  81. #define hextoi(c) (((c) >= '0' && (c) <= '9') ? ((c) - '0') : ((c) - 'a' + 10))
  82.  
  83. typedef void (*readimf_hook) PARAMS ((ImageFamily *, int));
  84.  
  85. extern ImageFamily *clone_imf PARAMS ((ImageFamily *imf));
  86. extern ImageFamily *get_imf PARAMS ((char *name));
  87. extern ImageFamily *find_imf PARAMS ((char *name));
  88. extern Image *find_img PARAMS ((ImageFamily *imf, int w, int h));
  89. extern Image *get_img PARAMS ((ImageFamily *imf, int w, int h));
  90. extern int valid_imf_name PARAMS ((char *name));
  91.  
  92. extern char *canonical_palette_name PARAMS ((char *str));
  93. extern ImagePalette *new_image_palette PARAMS ((char *name));
  94. extern ImagePalette *get_imp PARAMS ((char *name));
  95. extern ImagePalette *find_imp PARAMS ((char *name));
  96.  
  97. extern char *canonical_color_name PARAMS ((char *str));
  98. extern ImageColor *new_image_color PARAMS ((char *name));
  99. extern ImageColor *get_imc PARAMS ((char *name));
  100. extern ImageColor *find_imc PARAMS ((char *name));
  101.  
  102. extern ImageFile *get_image_file PARAMS ((char *name));
  103. extern void load_image_families PARAMS ((FILE *fp, int loadnow,
  104.                      readimf_hook callback));
  105. extern int load_imf_file PARAMS ((char *filename,
  106.                   readimf_hook callback));
  107. extern void interp_imf_form PARAMS ((Obj *form,
  108.                      readimf_hook callback));
  109.  
  110. extern ImageFamily *interp_imf PARAMS ((Obj *form));
  111. extern void interp_imf_contents PARAMS ((ImageFamily *imf, Obj *form));
  112. extern void interp_image PARAMS ((ImageFamily *imf, Obj *size, Obj *parts));
  113. extern void interp_bytes PARAMS ((Obj *datalist, int numbytes, char *destaddr,
  114.               int jump));
  115. extern ImagePalette *interp_palette PARAMS ((Obj *form));
  116. extern ImageColor *interp_color PARAMS ((Obj *form));
  117.  
  118. extern Image *best_image PARAMS ((ImageFamily *imf, int w, int h));
  119.  
  120. extern void sort_all_images PARAMS ((void));
  121. extern void sort_all_palettes PARAMS ((void));
  122. extern void sort_all_colors PARAMS ((void));
  123.  
  124. extern void check_imf PARAMS ((ImageFamily *imf));
  125.  
  126. extern void write_imf PARAMS ((FILE *fp, ImageFamily *imf));
  127. extern void write_imp PARAMS ((FILE *fp, ImagePalette *imp));
  128. extern void write_imc PARAMS ((FILE *fp, ImageColor *imc));
  129.